#include <REGX52.H>
#include"Delay.h"
#include"key.h"
#include"Nixie.h"
#include"Timer0.h"
sbit motor=P1^0;
unsigned char T,C;
unsigned char keyn,speed;
void main()
{
	Timer0_Init();
 	while(1)
	{
		keyn=key();
		if(keyn==1)
		{
			speed++;
			speed%=4;
			if(speed==0) {T=0;}
			if(speed==1) {T=50;}
			if(speed==2) {T=75;}
			if(speed==3) {T=100;}
		}
		Nixie(1,speed);
	}
}

void Timer0_Routine() interrupt 1
{
	TL0 = 0x9C;		
	TH0 = 0xFF;	
  C++;
  C%=100;
  if(C<T)
	{
		motor=1;
	}	
	else
	{
		motor=0;
	}
}